﻿@page
@{ Layout = "_Layout"; }

@section Styles{
    <style>
        .el-upload{
            text-align:left;
        }
        .el-upload--picture-card{
            border:none !important;
            height:0;line-height:0;
        }
    </style>
}

<el-card>
    <div slot="header" class="clearfix">
        <span>{{ id>0 ? "修改" : "新增" }}商品</span>
        <el-button style="float: right;padding:3px 0;" type="text" v-on:click="utils.closeLayer(false)"><i class="el-icon-close"></i></el-button>
    </div>
    <el-scrollbar class="scrollbar" :style="{ height: ($(window).innerHeight()-180) + 'px' }">
        <div style="margin-right:18px;">
            <el-form v-on:submit.native.prevent ref="form" :model="form" :size="euiSize" status-icon label-width="140px">
                <el-form-item label="名称" prop="name" :rules="[{ required: true, message: '请输入名称' }]">
                    <el-input v-model="form.name"></el-input>
                </el-form-item>
                <el-form-item label="描述" prop="description">
                    <el-input ref="subject" type="textarea" :autosize="{ minRows: 3}" v-model="form.subject"></el-input>
                    <el-link type="primary" icon="el-icon-document" v-on:click="btnOpenEditClick('subject','form')">富文本编辑</el-link>
                </el-form-item>
                <el-form-item label="需要积分" prop="point">
                    <el-input-number v-model="form.point" :min="0"></el-input-number>
                </el-form-item>
                <el-form-item label="领取方式" prop="shopType">
                    <el-radio-group v-model="form.shopType">
                        <el-radio label="OnSelf">用户选择</el-radio>
                        <el-radio label="Online">线上发货</el-radio>
                        <el-radio label="Offline">线下领取</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item v-if="form.shopType!=='Online'" label="领取地址" prop="offLineAddress" :rules="[{ required: true, message: '请输入领取地址' }]">
                    <el-input type="textarea" :autosize="{ minRows: 3}" v-model="form.offLineAddress"></el-input>
                </el-form-item>
                <el-form-item label="图片" align="left">
                    <el-card>
                        <el-upload :headers="{Authorization: 'Bearer ' + $token}"
                                    multiple
                                   :action="uploadUrl"
                                   :on-preview="uploadPreview"
                                   :on-remove="uploadRemove"
                                   :file-list="fileList"
                                   :before-upload="uploadBefore"
                                   :on-progress="uploadProgress"
                                   :on-success="uploadSuccess"
                                   :on-error="uploadError"
                                   list-type="picture-card">
                            <el-button size="small" type="primary">上传图片</el-button>
                        </el-upload>
                    </el-card>
                </el-form-item>
                <el-form-item label="状态" prop="locked">
                    <el-select v-model="form.locked">
                        <el-option label="启用" :value="false"></el-option>
                        <el-option label="停用" :value="true"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
        </div>
    </el-scrollbar>
</el-card>
<el-row align="center" style="margin-top:18px;">
    <el-col :span="24" align="center">
        <el-button icon="el-icon-check" type="primary" v-on:click="btnSubmitClick" :size="euiSize">确 定</el-button>
        <el-button icon="el-icon-close" :size="euiSize" v-on:click="utils.closeLayerSelf">取 消</el-button>
    </el-col>
</el-row>

@section Scripts{
<script src="/sitefiles/assets/js/admin/points/giftsEdit.js" type="text/javascript"></script> }